Skip to content

fix: hide swap gas sponsorship banner for hardware wallets#29896

Closed
dawnseeker8 wants to merge 1 commit into
mainfrom
fix/29870-hw-gas-sponsorship-swap
Closed

fix: hide swap gas sponsorship banner for hardware wallets#29896
dawnseeker8 wants to merge 1 commit into
mainfrom
fix/29870-hw-gas-sponsorship-swap

Conversation

@dawnseeker8
Copy link
Copy Markdown
Contributor

Summary

  • hide the gas sponsorship banner in bridge/swap quote details when the source account is a hardware wallet
  • keep existing sponsorship behavior for non-hardware wallets, including same-chain insufficient-balance fallback logic
  • add regression tests covering hardware-wallet paths where sponsorship previously rendered incorrectly

Test plan

  • yarn jest app/components/UI/Bridge/hooks/useShouldRenderGasSponsoredBanner/index.test.ts

Related issue

Made with Cursor

Prevent swap quote sponsorship UI from rendering for hardware wallets, including sponsored-quote and insufficient-balance fallback paths, to align MON/SEI behavior with hardware wallet constraints.

Co-authored-by: Cursor <cursoragent@cursor.com>
@dawnseeker8 dawnseeker8 self-assigned this May 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbotv2 metamaskbotv2 Bot added the team-be-trade BE Trade team label May 8, 2026
@github-actions github-actions Bot added the size-S label May 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeSwap, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 92%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are narrowly scoped to the Bridge/Swap UI layer:

  1. useShouldRenderGasSponsoredBanner/index.ts: Adds useIsHardwareWalletForBridge() check so the gas-sponsored banner is suppressed when the source account is a hardware wallet. This prevents showing gas sponsorship UI to hardware wallet users who cannot benefit from sponsored/EIP-7702 flows.

  2. index.test.ts: Adds unit tests covering the two new hardware wallet exclusion scenarios.

Why SmokeSwap: The change directly affects the Bridge/Swap flow UI — specifically the gas-sponsored banner that appears during swap/bridge quote flows. This is core swap functionality.

Why SmokeConfirmations: Per the SmokeSwap tag description, when selecting SmokeSwap, also select SmokeConfirmations since transaction confirmations are part of the swap/bridge flow.

No other tags needed: The change is isolated to a single hook within the Bridge UI. It doesn't touch navigation, account management, network selection, snaps, identity, or any other feature area. The useIsHardwareWalletForBridge hook was already existing and is simply being reused here.

Risk is low: This is an additive guard condition (adds !isHardwareWallet && to the boolean expression). It only affects hardware wallet users in the bridge flow, and the logic is straightforward. No core controllers, Engine, or shared infrastructure is modified.

Performance Test Selection:
The change adds a single boolean hook call (useIsHardwareWalletForBridge()) to an existing hook. This is a trivial computation (a memoized selector check) with no meaningful performance impact on rendering, data loading, or app startup. No performance tests are warranted.

View GitHub Actions results

@dawnseeker8
Copy link
Copy Markdown
Contributor Author

Will recreate one using metamask template format.

@dawnseeker8 dawnseeker8 closed this May 8, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators May 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Gas sponsorship - Gas sponsorship label is shown on swap if more than max amount is entered on Mon/Sei

2 participants